package example1;

/**
 * <h3>designPattern</h3>
 * <p>HummerModel抽象类</p>
 * @author : zhang.bw
 * @date : 2021-02-27 17:30
 **/
public abstract class HummerModel {

	public abstract void start(); //发动
	public abstract void stop();  //停止
	public abstract void alarm(); //鸣笛
	public abstract void engineBoom(); //轰鸣
	//public abstract void run(); //车跑起来

	/*final public void run() { //车跑起来
		this.start();
		this.engineBoom();
		this.alarm();
		this.stop();
	}*/

	final public void run() { //车跑起来
		this.start();
		this.engineBoom();
		if(this.isAlarm()) {//想让它叫就叫，不想就不叫
			this.alarm();
		}
		this.stop();
	}
	protected boolean isAlarm() { //我们加了一个判断方法，默认返回true
		return true;
	}

}
